package com.jy.framework.base;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;

/**
 * @Author JuiceYan
 * @Description 公共属性
 * @Date 2018-12-15
 **/
@Data
public class TreeEntity extends BaseEntity implements Serializable {
    /**
     * 主键
     */
    @TableId
    @ApiModelProperty(value = "主键")
@Excel(name = "主键")
    private Long id;

    @NotNull(message = "请选择上级id")
    @ApiModelProperty(value = "父级编号")
@Excel(name = "父级编号")
    protected Long parentId;
    /**
     * 名称
     */
    @ApiModelProperty(value = "所有父级编号")
@Excel(name = "所有父级编号")
    protected String parentIds;
    /**
     * 上级名
     */
    @TableField(exist = false)
    protected String parentName;
    /**
     * 排序
     */
    @ApiModelProperty(value = "排序")
@Excel(name = "排序")
    protected Long orderNum;
    @TableField(exist = false)
    private List<? extends TreeEntity> nodes;

    public TreeEntity(Long id) {
        super(id);
        this.id = id;
    }

    public TreeEntity() {
        super();
    }
}
